import random

import pygame.sprite

"""
奖品类
"""


class Prize(pygame.sprite.Sprite):
    def __init__(self, x: int, y: int):
        """
        奖品类参数初始化
        :param x: x坐标
        :param y: y坐标
        """
        prize_id = random.randint(1, 4)
        super(Prize, self).__init__()
        self.image = pygame.image.load("./resources/images/prizes/prizes" + str(prize_id) + ".png")
        self.pos_x = x
        self.pos_y = y

    def draw(self, surface: pygame.surface, x: int, y: int):
        """
        绘制
        :param surface: 绘制对象
        :param x: x坐标
        :param y: y坐标
        :return: None
        """
        surface.blit(self.image, (self.pos_x - x, self.pos_y - y))


class Sword(pygame.sprite.Sprite):
    def __init__(self, x: int, y: int):
        """
        初始化武器类参数
        :param x: x坐标
        :param y: y坐标
        """
        super(Sword, self).__init__()
        self.image = pygame.image.load("./resources/images/sword/剑.png")
        self.pos_x = x
        self.pos_y = y
        x, y, w, h = self.image.get_rect()
        self.rect = pygame.Rect(self.pos_x, self.pos_y, w, h)

    def draw(self, surface: pygame.surface, x: int, y: int):
        """
        绘制武器类参数
        :param surface:
        :param x:
        :param y:
        :return:
        """
        surface.blit(self.image, (self.pos_x - x, self.pos_y - y))
